Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
astral-regex
Advanced tools
The astral-regex npm package is designed to provide a regular expression for matching astral symbols in text. Astral symbols are Unicode symbols that consist of a pair of surrogate halves and are used to represent characters outside the Basic Multilingual Plane (BMP). This package is particularly useful for applications that need to process, validate, or manipulate text containing such symbols, ensuring compatibility with the full range of Unicode characters.
Matching astral symbols
This feature allows you to match and extract astral symbols from a string of text. The code sample demonstrates how to use the package to find astral symbols within a given string. In this example, the astral symbol '𠮷' is successfully matched and extracted from the text.
"𠮷野家".match(astralRegex()); // Returns ['𠮷']
The emoji-regex package provides a regular expression to match Unicode emoji characters. While astral-regex is focused on matching any astral symbol, emoji-regex specializes in emojis, which are a subset of astral symbols. This makes emoji-regex more suitable for applications specifically dealing with emoji processing.
XRegExp is an extended JavaScript regex library that, among other enhancements, provides support for Unicode including astral symbols. Compared to astral-regex, XRegExp offers a broader range of regex features and capabilities, making it a more versatile choice for complex text processing tasks that require beyond basic astral symbol matching.
Regular expression for matching astral symbols
$ npm install astral-regex
const astralRegex = require('astral-regex');
astralRegex({exact: true}).test('🦄');
//=> true
'foo 🦄 💩 bar'.match(astralRegex());
//=> ['🦄', '💩']
Returns a RegExp
for matching astral symbols.
Type: Object
Type: boolean
Default: false
(Matches any astral symbols in a string)
Only match an exact string. Useful with RegExp#test()
to check if a string is a astral symbol.
MIT © Kevin Mårtensson
FAQs
Regular expression for matching astral symbols
The npm package astral-regex receives a total of 16,295,243 weekly downloads. As such, astral-regex popularity was classified as popular.
We found that astral-regex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.